package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenBillSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerBillAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.finance.Bill;
import com.wlyuan.open.scanner.repository.BillRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.BILL)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerBillHandler extends BaseScannerHandler<Bill, OpenBillSyncDTO> {
    private final BillRepository billRepository;

    @Override
    protected List<Bill> select() {
        return billRepository.list();
    }

    @Override
    protected List<OpenBillSyncDTO> assembler(List<Bill> data) {
        return ScannerBillAssembler.assemble(data);
    }
}
